package bookExercise;

import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

public class A14findFirst {
    public static void main(String[] args) {
        List<A14Emplyee> list =A14Emplyee.getEmpList();
        Stream<A14Emplyee> stream =list.stream();
        stream = stream.filter(n -> n.getAge() == 21);
        Optional<A14Emplyee> young = stream.findFirst();
        System.out.println(young);
    }
}
